package com.eleme.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.eleme.entity.V_Shop_Main;
import com.eleme.service.Shopmenushow;
import com.google.gson.GsonBuilder;

/**
 * Servlet implementation class ShopMenuShow
 */
public class Shopshow extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub	
		int id = new Integer(request.getParameter("bussid")).intValue();
		List<V_Shop_Main> li=new Shopmenushow().findById(id);
		response.setContentType("text/html;charset=utf-8");
		response.getWriter().print(new GsonBuilder().create().toJson(li));
//		request.setAttribute("data",li );
//		request.getRequestDispatcher("/pages/mainpages/mainpages.jsp").forward(request, response);
//		System.out.println(li);
	}

}
